export function getApiPrefix(){
    return "/api"
}

//判断请求是否成功
export function isSuccessed(res):boolean{
    return res && res.code === "200";
}

/**
 * 下载Excel文件
 * @param res
 * @param fileName
 */
export function downloadExcel(res,fileName){
    if(!res){
        return;
    }
    const blob = new Blob([res],{type:"appliation/vnd.ms-excel"});
    const href = URL.createObjectURL(blob);
    const a = document.createElement("a");
    a.style.display = 'none';
    a.href = href;
    a.download = fileName;
    a.click();
    URL.revokeObjectURL(a.href);
}